import request from '@/utils/request';

const API = {
    // 心理预约记录
    PSYCHOLOGY_NOTE_URL: '/v01/biz/appointments/selectPsychology',
    // 心理预约记录老师端
    PSYCHOLOGY_NOTE_IN_TEACHER_URL: '/public/place/info/list',
    // 查询心里预约
    INQUIRE_PSYCHOLOGY_NOTE_URL: '/v01/biz/appointments',
    // 老师端心理预约
    GET_TEACHER_PSY_NOTE_URL: '/v01/biz/appointments/listPsychology',
    // 获取老师心里预约详情
    GET_TEACHER_PSY_DETAIL_URL: '/v01/biz/appointments/psychologyInfo',
    // 撤销心理预约
    CANCEL_PSYCHOLOGY_NOTE_URL: '/v01/biz/appointments/delPsychology',
    // 获取所有心理老师预约的信息
    GET_PSY_TEACHER_DETAIL_URL:
        '/v01/biz/appointments/getAllAppointmentTeacher',
    // 上传心理预约
    UPDATE_PSY_NOTE_URL: '/v01/biz/appointments/updatePsychology',
    // 完成心理预约
    COMPLETE_PSY_NOTE_URL: '/v01/biz/appointments/setEndPsychology',
    // 获取心理预约老师的具体申请内容
    GET_PSY_TEACHER_APPLY_URL: '/v01/biz/appointments/teacherInfo',
    // 获取心理预约申请的离开时间
    GET_PSY_LEAVE_TIME_OPTION_URL: '/v01/biz/appointments/teacherLeaveTime',
    // 获取心理预约申请的成功时间
    GET_PSY_SUCCESS_TIME_OPTION_URL: '/v01/biz/appointments/getSuccessTimes',
    // 申请心理预约
    ADD_PSYCHOLOGY_NOTE_URL: '/v01/biz/appointments/savePsychology'
};

// 获取心理预约记录
export const reqPsychologyNote = (pageNo, pageSize = 5) =>
    request.get(
        `${API.PSYCHOLOGY_NOTE_URL}?pageNo=${pageNo}&pageSize=${pageSize}`
    );

// 获取心理预约记录代办
export const reqPsychologyNoteUntreated = (pageNo, pageSize = 5) =>
    request.get(
        `${API.PSYCHOLOGY_NOTE_URL}?state=0&pageNo=${pageNo}&pageSize=${pageSize}`
    );

// 获取心理预约记录已办
export const reqPsychologyNoteProcessed = (pageNo, pageSize = 5) =>
    request.get(
        `${API.PSYCHOLOGY_NOTE_URL}?state=23&pageNo=${pageNo}&pageSize=${pageSize}`
    );

// 查询心理预约
export const reqInquirePsychologyNote = (
    urlName,
    pageNo,
    pageSize = 5,
    states,
    startTime,
    endTime,
    userName
) =>
    request.get(
        `${API.INQUIRE_PSYCHOLOGY_NOTE_URL}/${urlName}?pageNo=${pageNo}&pageSize=${pageSize}&${states}&startTime=${startTime}&endTime=${endTime}&userName=${userName}`
    );

// 获取老师的心理预约
export const reqTeacherPSYNote = (pageNo, pageSize = 5) =>
    request.get(
        `${API.GET_TEACHER_PSY_NOTE_URL}?pageNo=${pageNo}&pageSize=${pageSize}&restrictState=0`
    );

// 查询老师端的心理预约
export const reqInquireTeacherPsychologyNote = (
    pageNo,
    pageSize = 5,
    state,
    restrictState
) =>
    request.get(
        `${API.GET_TEACHER_PSY_NOTE_URL}?pageNo=${pageNo}&pageSize=${pageSize}&state=${state}&restrictState=${restrictState}`
    );

// 老师端获取心理预约
export const reqPsychologyNoteInTeacher = (pageNo, pageSize) =>
    request.get(
        `${API.PSYCHOLOGY_NOTE_IN_TEACHER_URL}?pageNo=${pageNo}&pageSize=${pageSize}`
    );

// 获取老师心里预约详情
export const reqPsychologyNoteDetail = id =>
    request.get(`${API.GET_TEACHER_PSY_DETAIL_URL}?id=${id}`);

// 撤销心理预约
export const reqCancelPsychologyNote = id =>
    request.delete(`${API.CANCEL_PSYCHOLOGY_NOTE_URL}?id=${id}`);

// 获取所有心理老师预约的信息
export const reqAllTeacherDetail = () =>
    request.get(API.GET_PSY_TEACHER_DETAIL_URL);

// 上传心理预约
export const reqUpdatePsychologyNote = data =>
    request.put(API.UPDATE_PSY_NOTE_URL, data);

// 完成心理预约
export const reqCompletePsychologyNote = data =>
    request.put(API.COMPLETE_PSY_NOTE_URL, data);

// 获取心理预约老师申请具体内容
export const reqPsyTeacherApplyContent = id =>
    request.get(`${API.GET_PSY_TEACHER_APPLY_URL}?id=${id}`);

// 获取心理预约申请的离开时间
export const reqLeaveTime = id =>
    request.get(`${API.GET_PSY_LEAVE_TIME_OPTION_URL}?teacherNum=${id}`);

// 获取心理预约申请的成功时间
export const reqSuccessTime = (id, date) =>
    request.get(
        `${API.GET_PSY_SUCCESS_TIME_OPTION_URL}?teacherNum=${id}&date=${date}`
    );

// 申请心理预约
export const reqAddPsychologNote = data =>
    request.post(API.ADD_PSYCHOLOGY_NOTE_URL, data);
